Skip to content

fix(lif): drop stale tile Y/X coords in grid- and stage-stitch reassemblers (cut v0.6.0)#44

Merged
ferrinm merged 1 commit into
mainfrom
fix/lif-grid-stitch-yx-coords-v0.6.0
Jul 2, 2026
Merged

fix(lif): drop stale tile Y/X coords in grid- and stage-stitch reassemblers (cut v0.6.0)#44
ferrinm merged 1 commit into
mainfrom
fix/lif-grid-stitch-yx-coords-v0.6.0

Conversation

@ferrinm

@ferrinm ferrinm commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix: reassemble_grid and reassemble_stage both preserved every input coord whose dims didn't touch M, which meant a per-tile Y/X pixel-space coord — attached by real bioio-lif readers — was carried onto a canvas of a different size. On the astrocytes LIF (48 scenes, 3x3 mosaics, 2048x2048 tiles → 6144x6144 canvas) that tripped xarray's dim/coord validator with:

    CoordinateValidationError: conflicting sizes for dimension 'Y':
    length 6144 on the data but length 2048 on coordinate 'Y'
    

    Fix: drop any coord whose dims touch Y or X, alongside the M-indexed ones. Non-spatial coords (T/C/Z, channel names) still survive untouched.

  • Regression tests: two new tests in test_lif_tiles.py attach tile-sized Y/X coords before calling each reassembler; both would have crashed pre-fix. The synthetic FakeReader fixtures don't attach Y/X coords, which is why CI stayed green while the real Leica LIF blew up.

  • Cut v0.6.0: bundles this fix with the unreleased #40 stage-stitch feature. Minor bump because #40 added a fourth public value on lif_mosaic since v0.5.0 — pure patch would under-signal the surface change.

Test plan

  • uv run pytest tests/test_lif_tiles.py tests/test_lif_grid_stitch.py tests/test_lif_stage_stitch.py — 70 passed locally
  • uv run pytest — full suite: 324 passed
  • After merge, tag v0.6.0 on the merge commit and re-run the astrocytes-LIF three-way comparison (auto-stitch vs grid-stitch vs stage-stitch) that motivated this fix — that's the actual #41 deliverable

🤖 Generated with Claude Code

…mblers

reassemble_grid and reassemble_stage both preserved every input coord whose
dims didn't touch M, which meant a per-tile Y/X pixel-space coord — attached
by real bioio-lif readers — was carried onto a canvas of a different size,
tripping xarray's dim/coord validator with

    CoordinateValidationError: conflicting sizes for dimension 'Y':
    length 6144 on the data but length 2048 on coordinate 'Y'

The synthetic FakeReader fixtures never attach Y/X coords, so this only
surfaced on a real 3x3 Leica LIF (2048x2048 tiles -> 6144x6144 canvas).
Fix: drop any coord whose dims touch Y or X, alongside the M-indexed ones.
Non-spatial coords (T/C/Z, channel names) still survive untouched.

Add regression tests to test_lif_tiles.py that attach tile-sized Y/X
coords before calling each reassembler; both would have failed pre-fix.

Cut v0.6.0 in CHANGELOG.md, bundling this fix with the unreleased #40
stage-stitch feature. Minor bump because #40 added a fourth public value
on lif_mosaic since v0.5.0 — pure patch under-signals the surface change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ferrinm
ferrinm merged commit a1a3a06 into main Jul 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant